package com.example.sale.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.sale.True.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT * FROM user WHERE username = #{username}")
    User findByUsername(@Param("username") String username);
    @Select("SELECT * FROM user WHERE username =#{username} and password=#{password} and role=#{role}")
    User findUser(@Param("username") String username,@Param("password") String password,@Param("role") String role);
    @Delete("delete  From user WHERE id = #{id}")
    Boolean removeBYTokenId(@Param("id") Integer id);
    @Delete("delete from productlistdetail where userid = #{id}")
    void deleteProductListDetailByUserId(@Param("id") Integer id);
    @Delete("delete from feedback where userid = #{id}")
    void deleteFeedBackByUserId(@Param("id") Integer id);
    @Select("SELECT password from user where id = #{id}")
    String FindPassword(@Param("id") Integer id);

}
